﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="addbook.aspx.vb" Inherits="bookmeetprototype.addBook" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><br /><br /><div class="addbook"><br />If you feel that we&#39;ve forgotten a book that you love, please fill out this form 
    below to help us keep the site fresh and dynamic!
    <h3>Title:</h3><asp:TextBox ID="tb_booktitle" runat="server"></asp:TextBox>
    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
        ControlToValidate="tb_booktitle" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
    <h3>Author:</h3><asp:TextBox ID="tb_bookauthor" runat="server"></asp:TextBox>
    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
        ControlToValidate="tb_bookauthor" Display="Dynamic" ErrorMessage="*" 
        ForeColor="Red"></asp:RequiredFieldValidator>
    <h3>Publication Date:</h3><asp:TextBox ID="tb_bookpubyear" runat="server" ></asp:TextBox>    <asp:CompareValidator ID="CompareValidatorTextBox1" runat="server"
    ControlToValidate="tb_bookpubyear"
    Type="Date"
    Operator="DataTypeCheck" 
    ErrorMessage="Date must be in the DD/MM/YYYY format)" ForeColor="Red"
    />
    <h3>Number of Pages:</h3><asp:TextBox ID="tb_bookpages" runat="server"></asp:TextBox>
    <asp:RangeValidator ID="RangeValidator1" runat="server" 
        ControlToValidate="tb_bookpages" 
        ErrorMessage="Please enter a number." ForeColor="Red" 
        MaximumValue="9999999" MinimumValue="1" SetFocusOnError="True" 
        Display="Dynamic"></asp:RangeValidator>


    <h3>Publisher:</h3><asp:TextBox ID="tb_publisher" runat="server"></asp:TextBox>
    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
        ControlToValidate="tb_publisher" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
         <h3>your blurb</h3> (A short description of the book)
    <asp:TextBox ID="tb_blurb" runat="server" Height="93px" Width="451px"></asp:TextBox>
    <br />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
        ControlToValidate="tb_blurb" 
        ErrorMessage="You must include a short description of the book!" 
        ForeColor="Red"></asp:RequiredFieldValidator>
    <br />
    <h3>add Book Cover (<em>optional</em>):</h3>
    <asp:FileUpload ID="fu_picture" runat="server" />
    &nbsp;<br />
    <h3>Your Rating:</h3>
    <p>    
        <asp:RadioButtonList ID="rbl_Stars" runat="server" 
        RepeatDirection="Horizontal" Width="142px">
        <asp:ListItem>1</asp:ListItem>
        <asp:ListItem>2</asp:ListItem>
        <asp:ListItem>3</asp:ListItem>
        <asp:ListItem>4</asp:ListItem>
        <asp:ListItem>5</asp:ListItem>
    </asp:RadioButtonList>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="rbl_Stars" ErrorMessage="Please select a value" 
            ForeColor="Red"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Button ID="btn_submission" runat="server" Text="Upload Book!" />
    </p>
 
</div><br /><br />
  
</asp:Content><asp:Content ID="Content3" ContentPlaceHolderID="SidebarContent" runat="server">
    <br />
    <br /><div style="overflow:visible;height:690px;width:270px;"><h1 style="text-align:center;">Popular Books:</h1>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
        <AlternatingItemTemplate>  <img class="templateimagefield" src='<%#Eval("imgurl") %>' alt="" />
            <li>Title:
                
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                <br />
                Author:
                <asp:Label ID="AuthorLabel" runat="server" Text='<%# Eval("Author") %>' />
                <br />
              
            </li>
        </AlternatingItemTemplate>
        <EditItemTemplate> <img class="templateimagefield" src='<%#Eval("imgurl") %>' alt="" />
            <li>Title:
               <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />
                Author:
                <asp:TextBox ID="AuthorTextBox" runat="server" Text='<%# Bind("Author") %>' />
                <br />
            
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
            </li>
        </EditItemTemplate>
        <EmptyDataTemplate>
            No data was returned.
        </EmptyDataTemplate>
        <InsertItemTemplate><img class="templateimagefield" src='<%#Eval("imgurl") %>' alt="" />
            <li>Title:
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />Author:
                <asp:TextBox ID="AuthorTextBox" runat="server" Text='<%# Bind("Author") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
            </li>
        </InsertItemTemplate>
        <ItemSeparatorTemplate>
<br />
        </ItemSeparatorTemplate>
        <ItemTemplate><img class="templateimagefield" src='<%#Eval("imgurl") %>' alt="" />
            <li>Title:
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                <br />
                Author:
                <asp:Label ID="AuthorLabel" runat="server" Text='<%# Eval("Author") %>' />
                <br />
                
            </li>
        </ItemTemplate>
        <LayoutTemplate>
            <ul ID="itemPlaceholderContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                <li runat="server" id="itemPlaceholder" />
            </ul>
            <div style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate><img class="templateimagefield" src='<%#Eval("imgurl") %>' alt="" />
            <li>Title:
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                <br />
                Author:
                <asp:Label ID="AuthorLabel" runat="server" Text='<%# Eval("Author") %>' />
                <br />
                
            </li>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BookMeetConnString %>" 
        ProviderName="<%$ ConnectionStrings:BookMeetConnString.ProviderName %>" 
        SelectCommand="SELECT [Title], [Author], [imgurl] FROM [booklist] WHERE ([AverageRating] &gt;= ?)">
        <SelectParameters>
            <asp:Parameter DefaultValue="5" Name="AverageRating" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource></div>
</asp:Content>
